
// CActionListDemoDlg.cpp : implementation file
//

#include "stdafx.h"
#include "CActionListDemo.h"
#include "CActionListDemoDlg.h"
#include "BtnST.h"
//#include "btnst.cpp"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif


// CCActionListDemoDlg dialog




CCActionListDemoDlg::CCActionListDemoDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CCActionListDemoDlg::IDD, pParent)
{
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CCActionListDemoDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_LIST1, Lista);
	DDX_Control(pDX, IDC_BUTTON1, gumb1);
}

BEGIN_MESSAGE_MAP(CCActionListDemoDlg, CDialog)
	ON_WM_PAINT()
	ON_WM_QUERYDRAGICON()
	//}}AFX_MSG_MAP
	ON_BN_CLICKED(IDC_BUTTON1, &CCActionListDemoDlg::OnBnClickedButton1)
	ON_BN_CLICKED(IDC_BUTTON2, &CCActionListDemoDlg::OnBnClickedButton2)
END_MESSAGE_MAP()


// CCActionListDemoDlg message handlers

BOOL CCActionListDemoDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon
	Lista.ModifyStyle(0,WS_CLIPCHILDREN ,0);
	gumb1.SetFlat(TRUE,TRUE);
	gumb1.SetBitmaps(IDB_BITMAP2,0,IDB_BITMAP1,0);
	gumb1.SetAlign(CButtonST::ST_ALIGN_OVERLAP,TRUE);
	gumb1.SizeToContent();
	gumb1.SetWindowTextW(_T("lol"));
	gumb1.DrawBorder(FALSE,TRUE);
	//TestBTN5.DrawFlatFocus(TRUE,TRUE);
	gumb1.SetPressedStyle(CButtonST::BTNST_PRESSED_NONE,TRUE);
	// TODO: Add extra initialization here
	Lista.AddItem();
	Lista.AddItem();
	Lista.AddItem();
	Lista.AddItem();
	Lista.AddItem();
	Lista.AddItem();
	Lista.AddItem();
	Lista.AddItem();
	Lista.AddItem();
	Lista.AddItem();
	Lista.AddItem();
	Lista.AddItem();
	
	return TRUE;  // return TRUE  unless you set the focus to a control
}

// If you add a minimize button to your dialog, you will need the code below
//  to draw the icon.  For MFC applications using the document/view model,
//  this is automatically done for you by the framework.

void CCActionListDemoDlg::OnPaint()
{
	if (IsIconic())
	{
		CPaintDC dc(this); // device context for painting

		SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);

		// Center icon in client rectangle
		int cxIcon = GetSystemMetrics(SM_CXICON);
		int cyIcon = GetSystemMetrics(SM_CYICON);
		CRect rect;
		GetClientRect(&rect);
		int x = (rect.Width() - cxIcon + 1) / 2;
		int y = (rect.Height() - cyIcon + 1) / 2;

		// Draw the icon
		dc.DrawIcon(x, y, m_hIcon);
	}
	else
	{
		CDialog::OnPaint();
	}
	Lista.Invalidate();
}

// The system calls this function to obtain the cursor to display while the user drags
//  the minimized window.
HCURSOR CCActionListDemoDlg::OnQueryDragIcon()
{
	return static_cast<HCURSOR>(m_hIcon);
}


void CCActionListDemoDlg::OnBnClickedButton1()
{
	// TODO: Add your control notification handler code here
	Lista.AddItem();
}

void CCActionListDemoDlg::OnBnClickedButton2()
{
	 int index;
      CString strText;
	 index = Lista.GetCurSel();

        Lista.DeleteString(index);
	// TODO: Add your control notification handler code here
}
